<%@page import="com.railway.files.model.FilesVideoColumns" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/commons/taglibs.jsp" %>

<html>

<head>
	<link rel="stylesheet" type="text/css" href="${ctx}/css/default.css" />
		<link rel="stylesheet" href="${ctx}/css/ztree.css" type="text/css">
		<link rel="stylesheet" href="${ctx}/css/zTreeStyle/zTreeStyle.css"	type="text/css">
				
		<link href="${ctx}/commons/upload/css/uploadify.css" rel="stylesheet" type="text/css" />
		
		
		<script type="text/javascript"
			src="${ctx}/scripts/jquery-1.4.2.min.js"></script>
		<script type="text/javascript"
			src="${ctx}/scripts/jquery.easyui.min.js"></script>
		<script type="text/javascript"
			src="${ctx}/scripts/locale/easyui-lang-zh_CN.js"></script>
		<script type="text/javascript"
			src="${ctx}/scripts/jquery-1.4.4.min.js"></script>
		<script type="text/javascript"
			src="${ctx}/commons/upload/js/swfobject.js"></script>
		<script type="text/javascript"
			src="${ctx}/commons/upload/js/jquery.uploadify.v2.1.4.js"></script>
		<script type="text/javascript"
			src="${ctx}/scripts/jquery.ztree.core-3.0.min.js"></script>
		<script type="text/javascript"
			src="${ctx}/scripts/jquery.ztree.excheck-3.0.min.js"></script>
	
	<script type="text/javascript"> 	
	function deleteUploadedFiles(){
	      jQuery('#fileupload').uploadifyClearQueue();
	      parent.form1.fileImg.value = "";
	      $('.files').empty();
        
	     /* if(form1.uploadedfileid.value == '') return;
		     $.get("${ctx}/files/Files/deleteByAjax.do?t="+Math.random(), {
                Action:"get","fileTypes":"ADDRESS",uploadedfileid:form1.uploadedfileid.value}, function (data, textStatus){	
   	              $('.files').empty();
         		  $('#filename').empty();
         		  form1.uploadedfileid.value = "";
         		
     
		   });	   */
	}
	        $(document).ready(function() {   

	            $("#fileupload").uploadify({
	           
	                 'allBytesLoaded':300 * 1024*1024,
	                /*注意前面需要书写path的代码*/ 
	                'uploader'       : '${ctx}/commons/upload/js/uploadify.swf', 
	                'script'         : '${ctx}/files/Files/upload.do?fileTypes=NEWS_HEAD', 
	                'cancelImg'      : '${ctx}/commons/upload/images/cancel.png', 
	                'queueID'        : 'fileQueue', //和存放队列的DIV的id一致 
	                'fileDataName'   : 'fileupload', //和以下input的name属性一致 
	                'auto'           : false, //是否自动开始 
	                'multi'          : false, //是否支持多文件上传 
	                'buttonText'     : '选择文件', //按钮上的文字 
	                'simUploadLimit' : 1, //一次同步上传的文件数目 
	                'sizeLimit'      : 30* 1024 * 1024, //设置单个文件大小限制 
	                'queueSizeLimit' : 1, //队列中同时存在的文件个数限制 
	                'fileDesc'       : '支持格式:jpg/gif/jpeg/png/bmp.', //如果配置了以下的'fileExt'属性，那么这个属性是必须的 
	                'fileExt'        : '*.jpg;*.gif;*.jpeg;*.png;*.bmp',//允许的格式   
	            onComplete: function (event, queueID, fileObj, response, data) { 
      			     var objs = eval("["+response+"]");	               
	                 parent.form1.fileImg.value = objs[0].fileImgpath;	                
					$('<li></li>').appendTo('.files').text(objs[0].uploadedresult); 
	}, 
	       onError: function(event, queueID, fileObj) { 
	             alert("文件:" + fileObj.name + "上传失败"); 
	       }, 
	       onCancel: function(event, queueID, fileObj){ 
	    //   alert("取消了" + fileObj.name); 
	       } 
	       }); 


	
	        }); 
	        </script> 
	
	<script type="text/javascript"> 
	      
	function uploadifyUpload1(){ 
	   
 
	   $('#fileupload').uploadifyUpload(); 
	} 
	</script> 
	
	
	<title><%=FilesVideoColumns.TABLE_ALIAS%>新增</title>
</head>
<body>

 <table border="0">
	   <tr> 
	<td>题头图片：</td> 
	<td> 
	<input type="file" name="fileupload" id="fileupload" />

	<div id="fileQueue"></div> 
	<p> 
	<a href="javascript:;" onClick="javascript:uploadifyUpload1()">开始上传</a>&nbsp; 
	<a href="javascript:deleteUploadedFiles();">取消所有上传</a> 
	</p> 
	<ol class=files></ol> 
	</td> 
 </table>
</body>
</html>